#ifndef XMLREADER_H
#define XMLREADER_H

#include <QObject>
#include <QPointer>
#include <QStringList>
#include <QXmlStreamReader>

class QAbstractTableModel;
class StandardTableModel;

class XmlReader : public QObject
{
    Q_OBJECT
public:
    explicit XmlReader(QObject *parent = 0);
    ~XmlReader();

public:
    QAbstractTableModel* convertToModel (QString message);
    void readAnswer();
    void readRecord();
    void readField();
    QXmlStreamReader::Error error() const;
    QString errorString() const;

private:
    bool isRecordName(QString name);

    QXmlStreamReader* m_xml;
    QPointer<StandardTableModel> m_model;
    QVariantList m_fields;
    bool m_headerFilled;
    QStringList m_recordNames;
};

#endif // XMLREADER_H
